<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Charsets and submitting forms</title>
</head>
<body>
<form name="f" method="?" action="textarea-setvalue-submit.html">
<textarea id="textarea1" name="textarea1">default value</textarea>
<textarea id="textarea2" name="textarea2" style="display:none">default value</textarea>
</form>
<script>

if (document.URL.indexOf('?') == -1) {

    if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.waitUntilDone();
    }
    
    var textarea1 = document.getElementById("textarea1");
    textarea1.value = "new value";
    var textarea2 = document.getElementById("textarea2");
    textarea2.value = "new value";
    
    document.f.submit();
        
} else {
    var formData = document.URL.substring(document.URL.indexOf('?') + 1, document.URL.length);
    var expected = "textarea1=new+value&textarea2=new+value";
    if (formData == expected)
        document.write("Success");
    else
        document.write("Failure.  The value set in the textarea via javascript wasn't sent when the form was submitted.  Expected: " + expected + ", Found: " + formData);
    
    if (window.testRunner)
        testRunner.notifyDone();
}

</script>
</body>
</html>